package cn.wwcyc.controller;


import cn.wwcyc.domain.D;
import cn.wwcyc.domain.Emp;
import cn.wwcyc.domain.R;

import cn.wwcyc.service.EmpService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    EmpService empService;
    @PostMapping("list")
    public R<List<Emp>> getList(@RequestParam(required = false)  String str, @RequestParam(required = false) Date startdate, @RequestParam(required = false)  Date  enddate, @RequestBody D d) {
        System.out.println(startdate);
        System.out.println(enddate);
        System.out.println(str);
        System.out.println(d);
        List<Emp> list= empService.list();
        return R.success(list);
    }
    @GetMapping
    public String startJob( @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") LocalDateTime startdate, @RequestParam  @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm") LocalDateTime  enddate){
        System.out.println(startdate);
        System.out.println(enddate);
//        Date date = new Date(81, 5, 5, 12, 5);
//        LambdaQueryWrapper<Emp> qw = new LambdaQueryWrapper<>();
//        qw.ge(Emp::getHiredate, date);
//        List<Emp> list = empService.list(qw);
//        pcsJob = new PCSJob(new Date(81, 5, 5, 12, 5), new Date(82, 5, 5, 12, 5));
//        PCSJob pcsJob = new PCSJob();
//        Thread t = new Thread(pcsJob);
//
//        t.start();
//
////        System.out.println(list);
////        return list;
        return "ok";
    }
}
